package Thread;

public class Demo7 {
    public static void main(String[] args) {
        Thread t = new Thread(() ->{
            while(true){
                System.out.println("hello Thread");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        });

        t.start();

        //获取一下线程的属性
        System.out.println("线程id: " + t.getId());
        System.out.println("线程名字: " + t.getName());
        System.out.println("线程状态: " + t.getState());
        System.out.println("线程优先级: " + t.getPriority());

        //由于主线程和t线程,并发执行
        //主线程执行上述4个操作,执行了一部分的时候,t线程就执行打印了
    }
}
